package com.neusoft.elm;

import java.util.Scanner;

import javax.swing.Popup;

import com.neusoft.elm.View.AdminView;
import com.neusoft.elm.View.BusinessView;
import com.neusoft.elm.View.impl.AdminViewImpl;
import com.neusoft.elm.View.impl.BusinessViewImpl;
import com.neusoft.elm.po.Admin;
import com.neusoft.elm.po.Business;

public class ElmAdminEnty {
	
	//管理员的操作功能
	 public void work(){

			Scanner sc = new Scanner(System.in);


	
			System.out.println("----------------------------------------------------------------");
	
			System.out.println("|\t\t\t 饿了么后台管理系统 \t\t\t|");
	
			System.out.println("----------------------------------------------------------------");
			
			AdminView adminView = new AdminViewImpl();
			BusinessView businessView = new BusinessViewImpl();
			
			Admin admin = adminView.login();
/*			//TODO 冗余测试代码
			if(admin !=null){
				System.out.println("恭喜!登陆成功!");
			}else {
				System.out.println("登录");
			}
	*/		
			
			if(admin !=null){
			int menu = 0;
			while(menu !=5){
				
			System.out.println("\n========= 1.所有商家列表=2.搜索商家=3.新建商家=4.删除商家=5.退出系统 =========");
			System.out.println("亲亲~~,请输入你选择的菜单序号哟~~");
			menu = sc.nextInt();
			
			switch(menu){
			
				case 1:
					// System.out.println("1.所有商家列表");
					businessView.listBusinessAll();
					break;
					
				case 2:
					//System.out.println("2.搜索商家");
					businessView.listBusiness();//TODO   没改完!!!!!
					break;
				case 3:
					System.out.println("3.新建商家");
					break;
				case 4:
					System.out.println("4.删除商家");
					break;
				case 5:
					System.out.println("5.退出系统");
					break;
				default :
					System.out.println("亲亲~,人家看不懂哟~~");
					System.out.println("亲亲~,请重新输入呢~~");

					break;
			}
	
			

		 }
			}else{
				System.out.println("管理员用户名或密码错误!");
			}
	 }

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	new  ElmAdminEnty().work();
	
		
	}

}
